const Router = require("koa-router");

const {
  verifyAuth,
  verifyAdminPermission,
} = require("../middleware/auth.middleware");

const { verifyLabelExists } = require("../middleware/label.middleware");

const {
  create,
  list,
  detail,
  update,
  remove,
} = require("../controller/label.controller.js");

const labelRouter = new Router({ prefix: "/label" });

labelRouter.post("/", verifyAuth, verifyLabelExists, create);
labelRouter.get("/", list);
labelRouter.get("/:labelId", detail);
labelRouter.patch("/", verifyAuth, verifyLabelExists, update);
labelRouter.delete("/:labelId", verifyAuth, verifyAdminPermission, remove);

module.exports = labelRouter;
